@svizzle/utils/array-[number-boolean]

Methods

(static) makeIsWithinRange(range) → {function}

Source:
Since:
  • 0.1.0

Return a function expecting a number and returning true if the number is within the provided range. Note that the range is inclusive.

Example
> isWithinRange = makeIsWithinRange([0, 5])
> isWithinRange(2)
true
> isWithinRange(5)
true
> isWithinRange(8)
false
Parameters:
Name Type Description
range array

Array of two numbers

Returns:

predicate - Number -> Boolean

Type
function